Skip to content

Conversation

@staskus
Copy link
Contributor

@staskus staskus commented Aug 4, 2025

WOOMOB-945

Description

Scanning is still detected when the support view or any other SwiftUI .sheet is opened in POS. The largest issue is with coupons and support sheets, which detect text input with an external keyboard (or a macOS keyboard when testing on a simulator).

Solution

We already disable scanning when posModals are opened with modalManager.isPresented check within ItemListView. However, I haven't thought about doing the same for SwiftUI sheets.

However, we cannot keep using a native.sheet modifier and cleanly detect if a sheet is presented or not. I tried looking for such solutions unsuccessfully. Therefore, I decided to introduce a .posSheet wrapper which uses the same system as posModal to enable sheetManager.isPresented checks when needed.

This implementation relies on future POS development to use posSheet instead of sheet for barcode scanning prevention functionality to work. Therefore, there's always a chance some new sheet will be presented without preventing barcode scanning detection.

Steps to reproduce

  1. Open POS
  2. Confirm scanning works / macOS keyboard with simulator open are detected as scans
  3. Try opening sheets: (coupon creation, support, documentation) and barcode scanning
  4. Confirm barcode scanning is not registered in cart
  5. Dismiss the sheets
  6. Confirm barcode scanning is registered in cart again

Testing information

Tested on iPad Air 20.6 simulator


  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@staskus staskus added this to the 23.0 milestone Aug 4, 2025
@staskus staskus requested review from iamgabrielma and jaclync August 4, 2025 13:46
@staskus staskus added type: task An internally driven task. feature: POS labels Aug 4, 2025
@dangermattic
Copy link
Collaborator

1 Warning
⚠️ View files have been modified, but no screenshot or video is included in the pull request. Consider adding some for clarity.

Generated by 🚫 Danger

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Aug 4, 2025

App Icon📲 You can test the changes from this Pull Request in WooCommerce iOS Prototype by scanning the QR code below to install the corresponding build.

App NameWooCommerce iOS Prototype
Build Numberpr15972-04949bb
Version22.9
Bundle IDcom.automattic.alpha.woocommerce
Commit04949bb
Installation URL73psugu4l7fb0
Automatticians: You can use our internal self-serve MC tool to give yourself access to those builds if needed.

@jaclync jaclync self-assigned this Aug 5, 2025
Copy link
Contributor

@jaclync jaclync left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works well! Had to reset my scanner to factory settings to complete the barcode scanning onboarding, but other than that everything works as expected, not seeing unexpected scanned from input in support form and other forms.

.sheet(isPresented: $showSupport) {
.posSheet(isPresented: $showSupport) {
supportForm
.interactiveDismissDisabled(true)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unrelated to this PR, as it happens in trunk as well: I noticed that after confirming the email alert on top of the support form, there was no obvious way to exit the form. The "Done" CTA in the navigation bar is actually the CTA to dismiss the form after checking the code, but I thought it's to submit the form as a user. Since interactive dismissal is disabled, maybe we can rename this "Done" to some dismissing action like "Cancel" and place it in the leading edge.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great observation. It's an easy change, I will do it and merge.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simulator.Screen.Recording.-.iPad.Pro.11-inch.M4.-.2025-08-05.at.12.11.07.mov

@staskus staskus enabled auto-merge August 5, 2025 10:13
@staskus staskus merged commit 43a0e68 into trunk Aug 5, 2025
13 checks passed
@staskus staskus deleted the woomob-945-wooposbarcodes-disable-scanning-when-the-support-view-is branch August 5, 2025 10:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature: POS type: task An internally driven task.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants